home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Utilities ƒ / MPW Tools ƒ / Simula4.07 / Simula 4.07ƒ / SInterfaces / macEvent.sim < prev    next >
Encoding:
Text File  |  1989-05-01  |  1.5 KB  |  56 lines  |  [TEXT/????]

  1. % ---------------------------------------------------------------------------
  2. %    Class MACEvent
  3. %
  4. % Part of the interface to Macintosh Toolbox
  5. % MACEvent is part of the programming interface. Events are used to communicate
  6. % events to and from the program.
  7. % Se Inside Macintosh for a description of wah the attributes means.
  8. %
  9. % 890329/Boris Magnusson
  10. %
  11. % ---------------------------------------------------------------------------
  12. external class macPoint="::Sinterfaces:MacPoint";
  13. class MACEvent;
  14. begin
  15.     short integer modifiers;
  16.     short integer point_h;
  17.     short integer point_v;
  18.    integer e_when;
  19.     integer message;
  20.     short integer what;
  21.  
  22.     procedure CopyPoint(p); 
  23.         ref(macpoint) p;
  24.     begin
  25.         p.v:=point_v;
  26.         p.h:=point_h;
  27.     end;
  28.     procedure copyEvent(e); 
  29.         ref(macEvent) e;
  30.     begin
  31.         e.modifiers:=modifiers;
  32.         e.point_h:=point_h;
  33.         e.point_v:=point_v;
  34.         e.e_when:=e_when;
  35.         e.message:=message;
  36.         e.what:=What;
  37.     end;
  38.     Boolean procedure OptionKey;
  39.             OptionKey:=mod(modifiers,2**12)//2**11<>0;
  40.     Boolean procedure CapsLock;
  41.             CapsLock:=mod(modifiers,2**11)//2**10<>0;
  42.     Boolean procedure ShiftKey;
  43.             ShiftKey:=mod(modifiers,2**10)//2**9<>0;
  44.     Boolean procedure commandKey;
  45.             CommandKey:=mod(modifiers,2**9)//2**8<>0;
  46.     Boolean procedure mouseButtonUp;
  47.             mouseButtonUp:=mod(modifiers,2**8)//2**7<>0;
  48.     Boolean procedure activated;
  49.             activated:=mod(modifiers,2**1)<>0;
  50.     character procedure keyPressed;
  51.         keyPressed:=char( mod(Message,2**8) );
  52.     integer  procedure keyCode;
  53.         keyCode:= mod(Message,2**16)//2**8;
  54.     
  55. end;
  56.